SIGNAL Statements ---------------------------------------------------------------------------- Action Enable, disable, or suspend event trapping for an OS-2 protected-mode signal. Syntax SIGNAL( n%) ON SIGNAL( n%) OFF SIGNAL( n%) STOP Remarks The argument n% identifies an OS-2 protected-mode signal. The following table lists the numbers of the protected-mode signals. ----------------------------------------------------------------------------- Number Signal ---------------------------------------------------------------------------- 1 Ctrl+C 2 Pipe connection broken 3 Program terminated 4 Ctrl+Break 5 Process flag A 6 Process flag B 7 Process flag C SIGNAL( n%) OFF disables trapping of OS-2 signal n%. No trapping takes place until another SIGNAL( n%) ON statement is executed. Events occurring while trapping is off are ignored. SIGNAL( n%) STOP suspends trapping of OS-2 signal n%. No trapping takes place until a SIGNAL( n%) ON statement is executed. Events occurring while trapping is suspended are remembered and processed when the next SIGNAL( n%) ON statement is executed. However, remembered events are lost if SIGNAL( n%) OFF is executed. When a signal-event trap occurs (that is, the GOSUB is performed), an automatic SIGNAL STOP is executed so that recursive traps cannot take place. The RETURN operation from the trapping routine automatically performs a SIGNAL ON statement unless an explicit SIGNAL OFF was performed inside the routine. For more information, see Chapter 9, "Event Handling" in the Programmer's Guide. Note The SIGNAL statement is available only for OS-2 protected mode. See Also ON event Example The following example uses ON SIGNAL to trap an event in the OS-2 operating system. PRINT "This program traps Ctrl+Break. Press Q to quit." EVENT ON ' Set up the signal-event trap and enable. ON SIGNAL(4) GOSUB CtrlBreak SIGNAL(4) ON ' Wait until the signal event occurs. DO . LOOP UNTIL UCASE$(INKEY$) = "Q" PRINT "'Q' pressed - Program terminating normally." END CtrlBreak. PRINT "A SIGNAL(4) event occurred." PRINT "Press 'Q' to quit." RETURN